#! /usr/bin/env python
# -*- coding: utf-8 -*-

# *************************************************************
#  Copyright (c) JoinQuant Development Team
#
#  Author: Huayong Kuang <kuanghuayong@joinquant.com>
#  CreateTime: 2017-12-16 11:28:06 Saturday
# *************************************************************

from __future__ import print_function

import mmap
import os

mm = mmap.mmap(-1, 13)
mm.write("Hello world!")

print("main process pid:", os.getpid())

pid = os.fork()

if pid == 0:  # In a child process
    mm.seek(0)
    print("child process pid:", os.getpid())
    print(mm.readline())

    mm.close()
